<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>建账记录列表</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<style type="text/css">		
	#contentTable td ,#contentTable th{
		text-align: center;
		padding:1px 20px;
	}
	.minWidth {
		min-width: 177px;
	}	
</style>
<script type="text/javascript">
$(document).ready(function() {
	initVaccName(bsVaccineBatchno.companyCode,bsVaccineBatchno.vaccineId);
	initVaccCompanyName(bsVaccineBatchno.companyCode)
	$(".vaccineCompany").change(function(){
		var vaccId = $(this).val();
		initCompanyName($(this).val());
		if(vaccId == ""){
			initVaccCompanyName("");
		}
	});
	$("#btnReset").click(function(){
		$("#vaccineId").val("").select2();
		$("#companyCode").val("").select2();
		$("#batchno").val("");
		$("#cType").val("").select2();
		$("#starttime").val("");
		$("#endtime").val("");
	})
});
var bsVaccineBatchno = JSON.parse('${fns:toJson(bsRecord.bsVaccineBatchno)}');
var bsRecord = JSON.parse('${fns:toJson(bsRecord)}');
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
      	return false;
      }

function down(){
	top.$.jBox.confirm("确认要导出出入库数据吗？","系统提示",function(v,h,f){
		if(v=="ok"){
			$("#searchForm").attr("action","${ctx}/vaccinate/bsProduct/export");
			$("#searchForm").submit();
		}
	},{buttonsFocus:1});
	top.$('.jbox-body .jbox-icon').css('top','55px');
}

</script>
</head>
<body>
	<ul class="nav nav-tabs">
	    <li class="active"><a href="#">建账记录</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsRecord" action="${ctx}/vaccinate/bsProduct/bsRecordCreate" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<table class="table table-bordered">
			<tr>
			    <th>疫苗类型：</th>
				<td>
					<form:select path="product.cType" id="cType" class="span2 minWidth">
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('bs_vaccineInfo_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select> 
				</td>
			    <th>疫苗名称:</th>
				<td>
					<form:select path="bsVaccineBatchno.vaccineId" id="vaccineId" class="span2 minWidth vaccineCompany" >
						<form:option value=""  label="--请选择--"/>
					</form:select>
				</td>
				<th>生产企业：</th>
				<td>
					<form:select path="bsVaccineBatchno.companyCode" id="companyCode" class="span2 minWidth changeCompany vaccCompanyName">
						<form:option value="" label="--请选择--"/> 
					</form:select>
				</td>
			</tr>
			<tr>
				<th>起始建账日期：</th>
				<td>
					<input name="starttime" id="starttime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsRecord.starttime}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<th>截止建账日期：</th>
				<td>
					<input name="endtime" id="endtime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsRecord.endtime}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<th>疫苗批号：</th>
				<td>
					<form:input type="text" path = "bsVaccineBatchno.batchno" id="batchno" class="input-medium" value="${bsRecord.bsVaccineBatchno.batchno}"/>
				</td>
			</tr>
		</table>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input id ="btnReset" class="btn btn-primary" type="button" value="重置"/>
		<input id="btnCancel" class="btn btn-primary" type="button" value="返 回" onclick="history.go(-1)"/>
	</form:form>
	
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编号</th>
				<th>疫苗名称</th>
				<th>疫苗属性</th>
				<th>疫苗生产企业</th>
				<th>批号</th>
				<th>规格(剂/支或粒)</th>
				<th>剂量</th>
				<th>剂型</th>
				<th>建账数量(支或粒)</th>
				<th>创建人</th>
				<th>创建日期</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="records"  step="1" varStatus="status">
			<tr>
				<td>
					${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td>
					${records.bsVaccineBatchno.vaccineName}
				</td>
				<td>
				    ${fns:getDictLabel(records.product.cType,'bs_vaccine_type','') }
				</td>
				<td>
					${records.bsVaccineBatchno.companyName}
				</td>
				<td>
					${records.bsVaccineBatchno.batchno}
					<c:if test="${not empty records.bsVaccineBatchno.secondBatchno}">
				        <span title="(查询批号时不需要带入亚批号)" style="color: #2fa4e7;">-${records.bsVaccineBatchno.secondBatchno}</span>
				    </c:if>
				</td>
				<td>${records.bsVaccineBatchno.spec}</td>
				<td>
					${records.bsVaccineBatchno.dose}
				</td>
				<td>
					${records.bsVaccineBatchno.doseType}
				</td>
				<td>
					${records.num}
				</td>
				<td>
			        ${records.creator}
				</td>
				<td>
					<fmt:formatDate value="${records.createDate}" pattern="yyyy-MM-dd"	/>
				</td>
				<td>
			        <a href="${ctx}/vaccinate/bsProduct/form?id=${records.id}">修改</a>
				    <a href="${ctx}/vaccinate/bsProduct/delete?id=${records.id}" onclick="return confirmx('确认要删除该建账记录吗？', this.href)">删除</a>
			    </td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>